# Contributor: Sandro Jäckel <sandro.jaeckel@posteo.de>
# Contributor: Sergei Lukin <sergej.lukin@gmail.com>
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=wget
pkgver=1.20.3
pkgrel=1
pkgdesc="A network utility to retrieve files from the Web"
url="https://www.gnu.org/software/wget/wget.html"
arch="all"
license="GPL-3.0-or-later"
makedepends="libidn2-dev openssl-dev perl"
checkdepends="perl-http-daemon"
subpackages="$pkgname-doc"
source="https://ftp.gnu.org/gnu/wget/wget-$pkgver.tar.gz"

# secfixes:
#   1.20.3-r0:
#     - CVE-2019-5953
#   1.20.1-r0:
#     - CVE-2018-20483
#   1.19.5-r0:
#     - CVE-2018-0494
#   1.19.1-r1:
#     - CVE-2017-6508
#   1.19.2-r0:
#     - CVE-2017-13090

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-libidn \
		--with-ssl=openssl \
		--disable-nls
	make
}

check() {
	# FIXME: We're not running top-level "check" to skip fuzz tests that
	# are currently broken.
	make -C tests check
}

package() {
	make DESTDIR="$pkgdir" install

	rm -rf "$pkgdir"/usr/lib
}

sha512sums="e8b82b40e270296228094a78d47f81580bdbdea9e6b93fd61b37dccb39430aeb9bda5397dc53a31c952a61629383c7e2a8c8abf414c8a4dd369af6ecf2717e6c  wget-1.20.3.tar.gz"
